home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / Snippets / Networking / Transition Queue Watcher / ATQWatcher.r < prev    next >
Encoding:
Text File  |  1993-01-08  |  9.0 KB  |  419 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware TextEdit Sample Application
  6. #
  7. #    TESample
  8. #
  9. #    TESample.r    -    Rez Source
  10. #
  11. #    Copyright © Apple Computer, Inc. 1989-1990
  12. #    All rights reserved.
  13. #
  14. #    Versions:    
  15. #                1.00                08/88
  16. #                1.01                11/88
  17. #                1.02                04/89    MPW 3.1
  18. #                1.03                02/90    MPW 3.2
  19. #
  20. #    Components:
  21. #                TESample.p            Feb.  1, 1990
  22. #                TESampleGlue.a        Feb.  1, 1990
  23. #                TESample.r            Feb.  1, 1990
  24. #                TESample.h            Feb.  1, 1990
  25. #                TESample.make        Feb.  1, 1990
  26. #
  27. #    TESample is an example application that demonstrates how 
  28. #    to initialize the commonly used toolbox managers, operate 
  29. #    successfully under MultiFinder, handle desk accessories and 
  30. #    create, grow, and zoom windows. The fundamental TextEdit 
  31. #    toolbox calls and TextEdit autoscroll are demonstrated. It 
  32. #    also shows how to create and maintain scrollbar controls.
  33. #
  34. #    It does not by any means demonstrate all the techniques you 
  35. #    need for a large application. In particular, Sample does not 
  36. #    cover exception handling, multiple windows/documents, 
  37. #    sophisticated memory management, printing, or undo. All of 
  38. #    these are vital parts of a normal full-sized application.
  39. #
  40. #    This application is an example of the form of a Macintosh 
  41. #    application; it is NOT a template. It is NOT intended to be 
  42. #    used as a foundation for the next world-class, best-selling, 
  43. #    600K application. A stick figure drawing of the human body may 
  44. #    be a good example of the form for a painting, but that does not 
  45. #    mean it should be used as the basis for the next Mona Lisa.
  46. #
  47. #    We recommend that you review this program or Sample before 
  48. #    beginning a new application. Sample is a simple app. which doesn’t 
  49. #    use TextEdit or the Control Manager.
  50. #
  51. ------------------------------------------------------------------------------*/
  52.  
  53. #include "systypes.r"
  54. #include "types.r"
  55.  
  56. #include "ATQWatcher.h"
  57.  
  58. resource 'vers' (1) {
  59.     0x02, 0x00, release, 0x00,
  60.     verUS,
  61.     "1.03",
  62.     "1.03, Copyright \251 Apple Computer, Inc. 1989-1990"
  63. };
  64.  
  65. /* we use an MBAR resource to conveniently load all the menus */
  66.  
  67. resource 'MBAR' (rMenuBar, preload) {
  68.     { mApple, mFile, mEdit, mControl };        /* three menus */
  69. };
  70.  
  71.  
  72. resource 'MENU' (mApple, preload) {
  73.     mApple, textMenuProc,
  74.     0b1111111111111111111111111111101,    /* disable dashed line, enable About and DAs */
  75.     enabled, apple,
  76.     {
  77.         "About TESample\311",
  78.             noicon, nokey, nomark, plain;
  79.         "-",
  80.             noicon, nokey, nomark, plain
  81.     }
  82. };
  83.  
  84. resource 'MENU' (mFile, preload) {
  85.     mFile, textMenuProc,
  86.     0b0000000000000000000100000000000,    /* enable Quit only, program enables others */
  87.     enabled, "File",
  88.     {
  89.         "New",
  90.             noicon, "N", nomark, plain;
  91.         "Open",
  92.             noicon, "O", nomark, plain;
  93.         "-",
  94.             noicon, nokey, nomark, plain;
  95.         "Close",
  96.             noicon, "W", nomark, plain;
  97.         "Save",
  98.             noicon, "S", nomark, plain;
  99.         "Save As\311",
  100.             noicon, nokey, nomark, plain;
  101.         "Revert",
  102.             noicon, nokey, nomark, plain;
  103.         "-",
  104.             noicon, nokey, nomark, plain;
  105.         "Page Setup\311",
  106.             noicon, nokey, nomark, plain;
  107.         "Print\311",
  108.             noicon, nokey, nomark, plain;
  109.         "-",
  110.             noicon, nokey, nomark, plain;
  111.         "Quit",
  112.             noicon, "Q", nomark, plain
  113.     }
  114. };
  115.  
  116. resource 'MENU' (mEdit, preload) {
  117.     mEdit, textMenuProc,
  118.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  119.     enabled, "Edit",
  120.      {
  121.         "Undo",
  122.             noicon, "Z", nomark, plain;
  123.         "-",
  124.             noicon, nokey, nomark, plain;
  125.         "Cut",
  126.             noicon, "X", nomark, plain;
  127.         "Copy",
  128.             noicon, "C", nomark, plain;
  129.         "Paste",
  130.             noicon, "V", nomark, plain;
  131.         "Clear",
  132.             noicon, nokey, nomark, plain
  133.     }
  134. };
  135.  
  136. resource 'MENU' (mControl, preload) {
  137.     mControl, textMenuProc,
  138.     0b0000000000000000000000000000011,    /* enable everything, program does the changing */
  139.     enabled, "Control",
  140.      {
  141.         "Prohibit .MPP Closure",
  142.             noicon, nokey, nomark, plain;
  143.         "Prohibit Name Change",
  144.             noicon, nokey, nomark, plain
  145.     }
  146. };
  147.  
  148.  
  149. /* this ALRT and DITL are used as an About screen */
  150.  
  151. resource 'ALRT' (rAboutAlert, purgeable) {
  152.     {40, 20, 160, 296}, rAboutAlert, {
  153.         OK, visible, silent;
  154.         OK, visible, silent;
  155.         OK, visible, silent;
  156.         OK, visible, silent
  157.     };
  158. };
  159.  
  160. resource 'DITL' (rAboutAlert, purgeable) {
  161.     { /* array DITLarray: 5 elements */
  162.         /* [1] */
  163.         {88, 184, 108, 264},
  164.         Button {
  165.             enabled,
  166.             "OK"
  167.         },
  168.         /* [2] */
  169.         {8, 8, 24, 274},
  170.         StaticText {
  171.             disabled,
  172.             "MultiFinder-Aware TextEdit Application"
  173.         },
  174.         /* [3] */
  175.         {32, 8, 48, 295},
  176.         StaticText {
  177.             disabled,
  178.             "Copyright \251 Apple Computer 1989-1990"
  179.         },
  180.         /* [4] */
  181.         {56, 8, 72, 136},
  182.         StaticText {
  183.             disabled,
  184.             "Brought to you by:"
  185.         },
  186.         /* [5] */
  187.         {80, 24, 112, 167},
  188.         StaticText {
  189.             disabled,
  190.             "Macintosh Developer  Technical Support"
  191.         }
  192.     }
  193. };
  194.  
  195.  
  196. /* this ALRT and DITL are used as an error screen */
  197.  
  198. resource 'ALRT' (rUserAlert, purgeable) {
  199.     {40, 20, 150, 260},
  200.     rUserAlert,
  201.     { /* array: 4 elements */
  202.         /* [1] */
  203.         OK, visible, silent,
  204.         /* [2] */
  205.         OK, visible, silent,
  206.         /* [3] */
  207.         OK, visible, silent,
  208.         /* [4] */
  209.         OK, visible, silent
  210.     }
  211. };
  212.  
  213.  
  214. resource 'DITL' (rUserAlert, purgeable) {
  215.     { /* array DITLarray: 3 elements */
  216.         /* [1] */
  217.         {80, 150, 100, 230},
  218.         Button {
  219.             enabled,
  220.             "OK"
  221.         },
  222.         /* [2] */
  223.         {10, 60, 60, 230},
  224.         StaticText {
  225.             disabled,
  226.             "Error. ^0."
  227.         },
  228.         /* [3] */
  229.         {8, 8, 40, 40},
  230.         Icon {
  231.             disabled,
  232.             2
  233.         }
  234.     }
  235. };
  236.  
  237.  
  238. resource 'WIND' (rDocWindow, preload, purgeable) {
  239.     {64, 60, 314, 460},
  240.     zoomDocProc, invisible, goAway, 0x0, "untitled"
  241. };
  242.  
  243.  
  244. resource 'CNTL' (rVScroll, preload, purgeable) {
  245.     {-1, 385, 236, 401},
  246.     0, visible, 0, 0, scrollBarProc, 0, ""
  247. };
  248.  
  249.  
  250. resource 'CNTL' (rHScroll, preload, purgeable) {
  251.     {235, -1, 251, 386},
  252.     0, visible, 0, 0, scrollBarProc, 0, ""
  253. };
  254.  
  255. resource 'STR#' (kErrStrings, purgeable) {
  256.     {
  257.     "You must run on 512Ke or later";
  258.     "Application Memory Size is too small";
  259.     "Not enough memory to run TESample";
  260.     "Not enough memory to do Cut";
  261.     "Cannot do Cut";
  262.     "Cannot do Copy";
  263.     "Cannot exceed 32,000 characters with Paste";
  264.     "Not enough memory to do Paste";
  265.     "Cannot create window";
  266.     "Cannot exceed 32,000 characters";
  267.     "Cannot do Paste";
  268.     "Cannot install Transition Queue Handler"
  269.     }
  270. };
  271.  
  272. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  273.  
  274. resource 'SIZE' (-1) {
  275.     dontSaveScreen,
  276.     acceptSuspendResumeEvents,
  277.     enableOptionSwitch,
  278.     canBackground,                /* we can background; we don't currently, but our sleep value */
  279.                                 /* guarantees we don't hog the Mac while we are in the background */
  280.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  281.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  282.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  283.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  284.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  285.     reserved,
  286.     reserved,
  287.     reserved,
  288.     reserved,
  289.     reserved,
  290.     reserved,
  291.     reserved,
  292.     kPrefSize * 1024,
  293.     kMinSize * 1024    
  294. };
  295.  
  296.  
  297. type 'MOOT' as 'STR ';
  298.  
  299.  
  300. resource 'MOOT' (0) {
  301.     "MultiFinder-Aware TextEdit Sample Application"
  302. };
  303.  
  304. resource 'STR ' (128) {
  305.     ".MPP Open Transition occured at"
  306. };
  307.  
  308. resource 'STR ' (129) {
  309.     ".MPP Close Transition occured at"
  310. };
  311.  
  312. resource 'STR ' (130) {
  313.     ".MPP Close Request Transition occured at"
  314. };
  315.  
  316. resource 'STR ' (131) {
  317.     ".MPP Close Request cancelled at"
  318. };
  319.  
  320. resource 'STR ' (132) {
  321.     "Network Transition event occured at"
  322. };
  323.  
  324. resource 'STR ' (133) {
  325.     "Flagship Name Transition occured at"
  326. };
  327.  
  328. resource 'STR ' (134) {
  329.     "Flagship Name Change requested at"
  330. };
  331.  
  332. resource 'STR ' (135) {
  333.     "Flagship Name Change cancelled at"
  334. };
  335.  
  336. resource 'STR ' (136) {
  337.     "Cable Range Transition occured at"
  338. };
  339.  
  340. resource 'STR ' (137) {
  341.     "CPU Speed Change Transition occured at"
  342. };
  343.  
  344. resource 'STR ' (138) {
  345.     "New Flagship name is "
  346. };
  347.  
  348. resource 'STR ' (139) {
  349.     "Reverting Flagship name to "
  350. };
  351.  
  352. resource 'STR ' (140) {
  353.     "Cable Range begins at "
  354. };
  355.  
  356. resource 'STR ' (141) {
  357.     " to "
  358. };
  359.  
  360. resource 'STR ' (142) {
  361.     "New connection occured."
  362. };
  363.  
  364. resource 'STR ' (143) {
  365.     "Connection broken."
  366. };
  367.  
  368. resource 'STR ' (200) {
  369.     "TransQueueWatcher"
  370. };
  371.  
  372.  
  373. resource 'BNDL' (128) {
  374.     'MOOT',
  375.     0,
  376.     {
  377.         'ICN#',
  378.         {
  379.             0, 128
  380.         },
  381.         'FREF',
  382.         {
  383.             0, 128
  384.         }
  385.     }
  386. };
  387.  
  388.  
  389. resource 'FREF' (128) {
  390.     'APPL',
  391.     0,
  392.     ""
  393. };
  394.  
  395.  
  396. resource 'ICN#' (128) {
  397.     { /* array: 2 elements */
  398.         /* [1] */
  399.         $"04 30 40 00 0A 50 A0 00 0B 91 10 02 08 22 08 03"
  400.         $"12 24 04 05 20 28 02 09 40 10 01 11 80 0C 00 A1"
  401.         $"80 03 FF C2 7E 00 FF 04 01 00 7F 04 03 00 1E 08"
  402.         $"04 E0 00 0C 08 E0 00 0A 10 E0 00 09 08 C0 00 06"
  403.         $"04 87 FE 04 02 88 01 04 01 88 00 84 00 88 00 44"
  404.         $"00 88 00 44 00 88 00 C4 01 10 01 88 02 28 03 10"
  405.         $"01 C4 04 E0 00 02 08 00 73 BF FB EE 4C A2 8A 2A"
  406.         $"40 AA AA EA 52 AA AA 24 5E A2 8A EA 73 BE FB 8E",
  407.         /* [2] */
  408.         $"04 30 40 00 0E 70 E0 00 0F F1 F0 02 0F E3 F8 03"
  409.         $"1F E7 FC 07 3F EF FE 0F 7F FF FF 1F FF FF FF BF"
  410.         $"FF FF FF FE 7F FF FF FC 01 FF FF FC 03 FF FF F8"
  411.         $"07 FF FF FC 0F FF FF FE 1F FF FF FF 0F FF FF FE"
  412.         $"07 FF FF FC 03 FF FF FC 01 FF FF FC 00 FF FF FC"
  413.         $"00 FF FF FC 00 FF FF FC 01 FF FF F8 03 EF FF F0"
  414.         $"01 C7 FC E0 00 03 F8 00 73 BF FB EE 7F BE FB EE"
  415.         $"7F BE FB EE 7F BE FB E4 7F BE FB EE 73 BE FB 8E"
  416.     }
  417. };
  418.  
  419.